package com.example.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description
 * @Date 2021/8/7
 * @Created by Jonathan
 */
@RestController
public class TestService /*implements BeanFactoryAware*/ {

    /*private BeanFactory beanFactory;

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        this.beanFactory = beanFactory;
    }*/

    @Autowired
    private TestService mySer;


    @GetMapping("/test/hh")
    //@LogAnnotation
    public String hello() {
        //TestService testService = (TestService) beanFactory.getBean("testService");
        //System.out.println("testService == service:" + (testService == service));
        System.out.println("this == service:" + (this == mySer));
        //System.out.println("this == testService:" + (this == testService));
        this.sayHi();
        this.sayHello();
        mySer.sayHi();
        mySer.sayHello();
        return "hello world";
    }

    //@LogAnnotation
    public void sayHi() {
        System.out.println("hi");
    }

    //@Transactional
    public void sayHello() {
        System.out.println("hello");
    }
}
